<%@tag import="by.epam.communalservices.dao.jdbc.JdbcDaoJkhTeam"%>
<%@tag import="by.epam.communalservices.entity.JkhTeam"%>
<%@tag import="java.sql.Connection"%>
<%@ attribute name="id" required="true"%>

<%@ attribute name="owner"%>

<%
    Connection con = (Connection) request.getSession().getAttribute("currentConnection");
	JkhTeam team = null;
	JdbcDaoJkhTeam teamDao = new JdbcDaoJkhTeam(con);
    if (getJspContext().getAttribute("id") != "" && Long.parseLong(getJspContext().getAttribute("id").toString()) > 0) {
        team = teamDao.read(Long.parseLong(getJspContext().getAttribute("id").toString()));
    }
    if (team!=null) {
        out.print(team.getId()+". <a href='team_edit?id="+team.getId()+"'>"+team.getSurname()+" "+team.getName()+"</a>");
        if (getJspContext().getAttribute("owner") != null) {
            request.setAttribute(getJspContext().getAttribute("owner").toString(), team.getIdOwner());
        }
    } else {
        if (getJspContext().getAttribute("owner") != null) {
            request.setAttribute(getJspContext().getAttribute("owner").toString(), "0");
        }
        out.print("-нет-");
    }
    
    
 %>